<template>
  <div class="register">
    <van-nav-bar
  title="注册"
  left-text="返回"
  right-text="企业注册"
  left-arrow
  @click-left="onClickLeft"
/>

<van-form @submit="onSubmit">
  <van-field
    v-model="phone"
    name="phone"
    left-icon="phone-o"
    placeholder="请输入手机号"
    :rules="[{ required: true, message: '请填写手机号' }]"
  />
<div class="registerTip">
<van-radio-group v-model="radio" direction="horizontal">
  <van-radio name="1"></van-radio>
</van-radio-group>
 <p>我已阅读并同意以下协议，接受免除或限制责任，诉讼管辖约定等条款，愿意同步创建账户</p>
</div>

  <div style="margin: 16px;">
    <van-button round block type="info" native-type="submit">同意协议并注册</van-button>
  </div>
</van-form>
  </div>
</template>

<script>
export default {
  name: 'register',
  data() {
    return {
      phone: '',
      radio: '',
    }
  },
  methods: {
    onClickLeft() {
      this.$router.back()
    },
    async onSubmit(value) {
      value.a = this.$router
      if (this.radio) {
        const res = await this.$store.dispatch('register/addInListAsync', value)
        console.log(res)
        if (res) {
          this.$router.push('/home')
        }
      }
      console.log(value)
    },
  },
}
</script>

<style lang="less" scoped>
.registerTip{
  padding: 0 50px;
  display: flex;
  justify-content: center;
}
</style>
